<?php

	#doc
	#	classname:	news
	#	scope:		PUBLIC
	#
	#/doc
	
	class news extends CActiveRecord
	{
		#	internal variables

		#	Constructor
		public static function model($className=__CLASS__)
		{
			return parent::model($className);
		}

		public function tableName()
		{
			return 'news';
		}
		
		public function recently ($limit)	
		{
			$this->getDbCriteria()->mergeWith(array(
				'order'=>'date DESC',
				'limit'=>$limit,

			));
		return $this;

		}
		
		
		public function add()
		{
		
		
		}
			
			 
			
		
		
		
		
		public function view()
		{
			return $this->recently(10)->findAll();

		}


		public function category($cat)
		{
			return $this->recently(2)->findAll('category=:category',array(':category'=>$cat));

		}

		public function type($type)
		{
			return $this->recently(10)->findAll('type=:type',array(':type'=>$type));
		}
	
	}
	###

?>